<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
</body>
<script>
    class Person {
        constructor(name, age) {
            this.name = name 
            this.age = age
        }
        sayHi() {
            console.log(
                `姓名 ${this.name},学号 ${this.number}`
            )
        }
    }
    class Student extends Person {
        constructor(name, number) {
            super(name)
            this.number = number
        }
        study() {
            console.log('study');
        }
    }
    class Teacher extends Person {
        constructor(name, major) {
            super(name)
            this.major = major
        }
        teach() {
            console.log(`${this.name} teach ${this.major}`);
        }
    }
    // 通过类 new 对象/实例
    const thinker = new Student('thinker', 10001)
    console.log(thinker.name,thinker.number);
    thinker.sayHi()
    thinker.study()
    const wing = new Teacher('wing', 'code')
    wing.teach()
    console.log(Student.prototype.__proto__);
    console.log(Person.prototype);
    console.log(Person.prototype === Student.prototype.__proto__);
    console.log(thinker.hasOwnProperty('sayHi'))
</script>
<script src="./面试题.js"></script>
</html>